package edu.hawaii.ics211.exam;

import static org.junit.Assert.assertEquals;
import org.junit.Test;

/**
 * Tests the CheckAnswer class.
 * 
 * @author Branden Ogata
 *
 */

public class TestCheckAnswer
{
  private static final String NEWLINE = "\n";
  
  /**
   * Ensures that the methods in CheckAnswer correctly check the code provided.
   * This requires that the given answer is saved into the correct testing directory
   * and that the testing works from the correct directory.  
   * 
   */
  
  @Test
  public void test()
  {
    String code = "";
    code += "  public static String helloWorld()" + NEWLINE;
    code += "  {" + NEWLINE;
    code += "    return \"Hello World!\";" + NEWLINE;
    code += "  }" + NEWLINE;

    assertEquals("Tests if the Hello World code in exam/ works correctly", 
                 "helloWorld: PASS [5.00/5.00 points]",
                 CheckAnswer.checkAnswer(code, "TestHelloWorld", 5));
  }

}
